<!DOCTYPE html>
{% load staticfiles %}
<html>

<head>
	<meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
	<title>{% block title %}{% endblock %}</title>
	<link rel="stylesheet" type="text/css" href="{% static 'css/reset.css' %}">
	<link rel="stylesheet" type="text/css" href="{% static 'css/animate.css' %}">
	<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
    {% block mycss %}{% endblock %}
    <script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/jquery-migrate-1.2.1.min.js' %}" type="text/javascript"></script>

</head>
<body>
<section class="headerwrap ">
    <header>
		<div  class="header2 header">

 			<div class="top">
				<div class="wp">
					<div class="fl"><p>服务电话：<b>8888888</b></p></div>
                        <!--登录后跳转-->
                        {% if request.user.is_authenticated %}
                            <div class="personal">
                        <dl class="user fr">
                            <dd>{{ request.user.username }}<img class="down fr" src="{% static 'images/top_down.png' %}"/></dd>
                            <dt><img width="20" height="20"  src="{{ MEDIA_URL }}{{ request.user.image }}"/></dt>
                        </dl>
                        <div class="userdetail">
                            <dl>
                                <dt><img width="80" height="80" src="{{ MEDIA_URL }}{{ request.user.image }}"/></dt>
                                <dd>
                                    <h2>django</h2>
                                    <p>{{ request.user.username }}</p>
                                </dd>
                            </dl>
                            <div class="btn">
                                <a class="personcenter fl" href="{% url 'users:user_info' %}">进入个人中心</a>
                                <a class="fr" href="{% url 'users:user_logout' %}">退出</a>
                            </div>
                        </div>
                    </div>
                            {# 用户登陆成功后,用户的未读消息个数提示 #}
                            <a href="usercenter-message.html">
                                <div class="msg-num"><span id="MsgNum">{{ request.user.get_message_counter }}</span></div>
                            </a>
                        {% else %}
                            <a style="color:white" class="fr registerbtn" href="{% url 'users:user_register' %}">注册</a>
                            <a style="color:white" class="fr loginbtn" href="{% url 'users:user_login' %}">登录</a>
						{% endif %}

				</div>
			</div>
            {% block middle%}
                <div class="middle">
                    <div class="wp">
                        <a href="/"><img class="fl" src="{% static 'images/logo1.png' %}"/></a>
                        <div class="searchbox fr">
                            <div class="selectContainer fl">
                                <span class="selectOption" id="jsSelectOption" data-value="course">
                                    公开课
                                </span>
                                <ul class="selectMenu" id="jsSelectMenu">
                                    <li data-value="course">公开课</li>
                                    <li data-value="org">课程机构</li>
                                    <li data-value="teacher">授课老师</li>
                                </ul>
                            </div>
                            <input id="search_keywords" class="fl" type="text" value="" placeholder="请输入搜索内容"/>
                            <img class="search_btn fr" id="jsSearchBtn" src="{% static 'images/search_btn.png' %}"/>
                        </div>
                    </div>
                </div>

                <nav>
                    <div class="nav">
                        <div class="wp">
                            <ul>
                                <li {% if request.path == "/" %} class="active" {% endif %} ><a href="/">首页</a></li>
                                <li {% if request.path|slice:":9" == "/courses/" %} class="active" {% endif %} >
                                    <a href="{% url 'courses:course_list' %}">
                                        公开课<img class="hot" src="{% static 'images/nav_hot.png' %}">
                                    </a>
                                </li>
                                <li {% if request.path|slice:":13" == "/orgs/teacher" %} class="active" {% endif %} >
                                    <a href="{% url 'orgs:teacher_list' %}">授课教师</a>
                                </li>
                                <li {% if request.path|slice:":9" == "/orgs/org" %} class="active" {% endif %}>
                                    <a href="{% url 'orgs:org_list' %}">授课机构</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            {% endblock %}
            
			</div>
    </header>
</section>

{% block content %}{% endblock %}

{% block footer %}
<footer>
		<div class="footer">
			<div class="wp">
				<ul class="cont">
					<li class="logo"><a href="/"><img src="{% static 'images/logo1.png' %}"/></a></li>
					<li class="code"><img src="{% static 'images/weixin.png' %}"/><p class="center">扫描关注微信</p></li>
					<li class="third"><img class="fl" src="{% static 'images/tell.png' %}"/><p class="tell">88888888</p><p class="time">周一至周日 9:00-18:00</p></li>
				</ul>

			</div>
			<p class="line"></p>
			<div class="wp clear">
                <span class="fl">? 2012 www.atguigu.com 谷粒教育-在线学习交流平台 保留所有权利</span>
                <span class="fr">copyright ? 2012 ICP备案证书号：蜀ICP备xxxxx号-1</span>
			</div>
		</div>
	</footer>
{% endblock %}

<section>
    <ul class="sidebar">
        <li class="qq">
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
        </li>
        <li class="totop"></li>
    </ul>
</section>
<script src="{% static 'js/selectUi.js' %}" type='text/javascript'></script>
<script src="{% static 'js/deco-common.js' %}" type='text/javascript'></script>
<script src="{% static 'js/plugins/laydate/laydate.js' %}" type="text/javascript"></script>
<script src="{% static 'js/plugins/layer/layer.js' %}"></script>
<script src="{% static 'js/plugins/queryCity/js/public.js' %}" type="text/javascript"></script>
<script src="{% static 'js/unslider.js' %}" type="text/javascript"></script>
<script src="{% static 'js/plugins/jquery.scrollLoading.js' %}"  type="text/javascript"></script>
<script src="{% static 'js/deco-common.js' %}"  type="text/javascript"></script>
<script src="{% static 'js/index.js' %}" type="text/javascript"></script>

{# 全局搜索功能 #}
<script>
    // 页面加载完成
    $(function () {
        // 点击搜索按钮 进行检索, 不使用ajax请求,需要页面进行跳转
        $('#jsSearchBtn').click(function () {
            var search_type = $('#jsSelectOption').attr('data-value');  // 获取搜索框中的选中的下拉列选项的值
            var key_words = $('#search_keywords').val();  // 获取搜索框中输入的值
            var url = '';

            // 判断搜索框选中的是哪个下拉列表,然后进行url拼接,进行页面跳转
            if(search_type == 'org'){
                url = '{% url 'orgs:org_list' %}';
            }else if(search_type == 'course'){
                url = '{% url 'courses:course_list' %}';
            }else{
                url = '{% url 'orgs:teacher_list' %}';
            }
            url = url + '?keywords=' + key_words;  // url拼接参数

            window.location.href = url  // 发送请求
        });

    });

</script>

{% block myjs %}{% endblock %}

</body>
</html>
